
'===============================================================================
'  Generated From - VbNet_SQL_dOOdads_BusinessEntity.vbgen
' 
'  ** IMPORTANT  **
'  How to Generate your stored procedures:
' 
'  SQL        = SQL_StoredProcs.vbgen
'  ACCESS     = Access_StoredProcs.vbgen
'  ORACLE     = Oracle_StoredProcs.vbgen
'  FIREBIRD   = FirebirdStoredProcs.vbgen
'  POSTGRESQL = PostgreSQL_StoredProcs.vbgen
'
'  The supporting base class SqlClientEntity is in the Architecture directory in "dOOdads".
'  
'  This object is 'MustInherit' which means you need to inherit from it to be able
'  to instantiate it.  This is very easilly done. You can Override properties and
'  methods in your derived class, this allows you to regenerate this class at any
'  time and not worry about overwriting custom code. 
'
'  NEVER EDIT THIS FILE.
'
'  Public Class YourObject
'    Inherits _YourObject
'
'  End Class
'
'===============================================================================

' Generated by MyGeneration Version # (1.3.0.3)

Imports System
Imports System.Data
Imports System.Data.SqlClient
Imports System.Collections
Imports System.Collections.Specialized

Imports MyGeneration.dOOdads

NameSpace ClassSigeco

Public MustInherit Class _si_venta_detalle
	Inherits SqlClientEntity

		Public Sub New() 
			Me.QuerySource = "si_venta_detalle"
			Me.MappingName = "si_venta_detalle"
		End Sub

	'=================================================================
	'  Public Overrides Sub AddNew()
	'=================================================================
	'
	'=================================================================
	Public Overrides Sub AddNew()
		MyBase.AddNew()
				
	End Sub
	
	Public Overrides Sub FlushData()
		Me._whereClause = nothing
		Me._aggregateClause = nothing		
		MyBase.FlushData()
	End Sub
	
		
	'=================================================================
	'  	Public Function LoadAll() As Boolean
	'=================================================================
	'  Loads all of the records in the database, and sets the currentRow to the first row
	'=================================================================
	Public Function LoadAll() As Boolean
	
		Dim parameters As ListDictionary = Nothing
		
		
    	Return MyBase.LoadFromSql("[" + Me.SchemaStoredProcedure + "proc_si_venta_detalleLoadAll]", parameters)
		
	End Function

	'=================================================================
	' Public Overridable Function LoadByPrimaryKey()  As Boolean
	'=================================================================
	'  Loads a single row of via the primary key
	'=================================================================
        Public Overridable Function LoadByPrimaryKey(ByVal IdVentaDetalle As Integer) As Boolean

            Dim parameters As ListDictionary = New ListDictionary()
            parameters.Add(_si_venta_detalle.Parameters.IdVentaDetalle, IdVentaDetalle)


            Return MyBase.LoadFromSql("[" + Me.SchemaStoredProcedure + "proc_si_venta_detalleLoadByPrimaryKey]", parameters)

        End Function

#Region "Parameters"
        Protected Class Parameters

            Public Shared ReadOnly Property IdVentaDetalle() As SqlParameter
                Get
                    Return New SqlParameter("@IdVentaDetalle", SqlDbType.Int, 0)
                End Get
            End Property

            Public Shared ReadOnly Property IdVenta() As SqlParameter
                Get
                    Return New SqlParameter("@IdVenta", SqlDbType.Int, 0)
                End Get
            End Property

            Public Shared ReadOnly Property IdMercaderia() As SqlParameter
                Get
                    Return New SqlParameter("@IdMercaderia", SqlDbType.Int, 0)
                End Get
            End Property

            Public Shared ReadOnly Property Cantidad() As SqlParameter
                Get
                    Return New SqlParameter("@Cantidad", SqlDbType.Int, 0)
                End Get
            End Property

            Public Shared ReadOnly Property Precio() As SqlParameter
                Get
                    Return New SqlParameter("@Precio", SqlDbType.Decimal, 0)
                End Get
            End Property

            Public Shared ReadOnly Property IdImpuesto() As SqlParameter
                Get
                    Return New SqlParameter("@IdImpuesto", SqlDbType.Int, 0)
                End Get
            End Property

            Public Shared ReadOnly Property PrecioFinal() As SqlParameter
                Get
                    Return New SqlParameter("@PrecioFinal", SqlDbType.Decimal, 0)
                End Get
            End Property

            Public Shared ReadOnly Property IdMercaderiaLote() As SqlParameter
                Get
                    Return New SqlParameter("@IdMercaderiaLote", SqlDbType.Int, 0)
                End Get
            End Property

            Public Shared ReadOnly Property MontoImpuesto() As SqlParameter
                Get
                    Return New SqlParameter("@MontoImpuesto", SqlDbType.Decimal, 0)
                End Get
            End Property

            Public Shared ReadOnly Property DescripcionIngreso() As SqlParameter
                Get
                    Return New SqlParameter("@DescripcionIngreso", SqlDbType.NVarChar, 2000)
                End Get
            End Property

        End Class
#End Region

#Region "ColumnNames"
        Public Class ColumnNames

            Public Const IdVentaDetalle As String = "idVentaDetalle"
            Public Const IdVenta As String = "idVenta"
            Public Const IdMercaderia As String = "idMercaderia"
            Public Const Cantidad As String = "cantidad"
            Public Const Precio As String = "precio"
            Public Const IdImpuesto As String = "idImpuesto"
            Public Const PrecioFinal As String = "precioFinal"
            Public Const IdMercaderiaLote As String = "idMercaderiaLote"
            Public Const MontoImpuesto As String = "montoImpuesto"
            Public Const DescripcionIngreso As String = "descripcionIngreso"

            Public Shared Function ToPropertyName(ByVal columnName As String) As String

                If ht Is Nothing Then

                    ht = New Hashtable

                    ht(IdVentaDetalle) = _si_venta_detalle.PropertyNames.IdVentaDetalle
                    ht(IdVenta) = _si_venta_detalle.PropertyNames.IdVenta
                    ht(IdMercaderia) = _si_venta_detalle.PropertyNames.IdMercaderia
                    ht(Cantidad) = _si_venta_detalle.PropertyNames.Cantidad
                    ht(Precio) = _si_venta_detalle.PropertyNames.Precio
                    ht(IdImpuesto) = _si_venta_detalle.PropertyNames.IdImpuesto
                    ht(PrecioFinal) = _si_venta_detalle.PropertyNames.PrecioFinal
                    ht(IdMercaderiaLote) = _si_venta_detalle.PropertyNames.IdMercaderiaLote
                    ht(MontoImpuesto) = _si_venta_detalle.PropertyNames.MontoImpuesto
                    ht(DescripcionIngreso) = _si_venta_detalle.PropertyNames.DescripcionIngreso

                End If

                Return CType(ht(columnName), String)

            End Function

            Private Shared ht As Hashtable = Nothing
        End Class
#End Region

#Region "PropertyNames"
        Public Class PropertyNames

            Public Const IdVentaDetalle As String = "IdVentaDetalle"
            Public Const IdVenta As String = "IdVenta"
            Public Const IdMercaderia As String = "IdMercaderia"
            Public Const Cantidad As String = "Cantidad"
            Public Const Precio As String = "Precio"
            Public Const IdImpuesto As String = "IdImpuesto"
            Public Const PrecioFinal As String = "PrecioFinal"
            Public Const IdMercaderiaLote As String = "IdMercaderiaLote"
            Public Const MontoImpuesto As String = "MontoImpuesto"
            Public Const DescripcionIngreso As String = "DescripcionIngreso"

            Public Shared Function ToColumnName(ByVal propertyName As String) As String

                If ht Is Nothing Then

                    ht = New Hashtable

                    ht(IdVentaDetalle) = _si_venta_detalle.ColumnNames.IdVentaDetalle
                    ht(IdVenta) = _si_venta_detalle.ColumnNames.IdVenta
                    ht(IdMercaderia) = _si_venta_detalle.ColumnNames.IdMercaderia
                    ht(Cantidad) = _si_venta_detalle.ColumnNames.Cantidad
                    ht(Precio) = _si_venta_detalle.ColumnNames.Precio
                    ht(IdImpuesto) = _si_venta_detalle.ColumnNames.IdImpuesto
                    ht(PrecioFinal) = _si_venta_detalle.ColumnNames.PrecioFinal
                    ht(IdMercaderiaLote) = _si_venta_detalle.ColumnNames.IdMercaderiaLote
                    ht(MontoImpuesto) = _si_venta_detalle.ColumnNames.MontoImpuesto
                    ht(DescripcionIngreso) = _si_venta_detalle.ColumnNames.DescripcionIngreso

                End If

                Return CType(ht(propertyName), String)

            End Function

            Private Shared ht As Hashtable = Nothing

        End Class
#End Region

#Region "StringPropertyNames"
        Public Class StringPropertyNames

            Public Const IdVentaDetalle As String = "s_IdVentaDetalle"
            Public Const IdVenta As String = "s_IdVenta"
            Public Const IdMercaderia As String = "s_IdMercaderia"
            Public Const Cantidad As String = "s_Cantidad"
            Public Const Precio As String = "s_Precio"
            Public Const IdImpuesto As String = "s_IdImpuesto"
            Public Const PrecioFinal As String = "s_PrecioFinal"
            Public Const IdMercaderiaLote As String = "s_IdMercaderiaLote"
            Public Const MontoImpuesto As String = "s_MontoImpuesto"
            Public Const DescripcionIngreso As String = "s_DescripcionIngreso"

        End Class
#End Region

#Region "Properties"
        Public Overridable Property IdVentaDetalle() As Integer
            Get
                Return MyBase.Getint(ColumnNames.IdVentaDetalle)
            End Get
            Set(ByVal Value As Integer)
                MyBase.Setint(ColumnNames.IdVentaDetalle, Value)
            End Set
        End Property

        Public Overridable Property IdVenta() As Integer
            Get
                Return MyBase.Getint(ColumnNames.IdVenta)
            End Get
            Set(ByVal Value As Integer)
                MyBase.Setint(ColumnNames.IdVenta, Value)
            End Set
        End Property

        Public Overridable Property IdMercaderia() As Integer
            Get
                Return MyBase.Getint(ColumnNames.IdMercaderia)
            End Get
            Set(ByVal Value As Integer)
                MyBase.Setint(ColumnNames.IdMercaderia, Value)
            End Set
        End Property

        Public Overridable Property Cantidad() As Integer
            Get
                Return MyBase.Getint(ColumnNames.Cantidad)
            End Get
            Set(ByVal Value As Integer)
                MyBase.Setint(ColumnNames.Cantidad, Value)
            End Set
        End Property

        Public Overridable Property Precio() As Decimal
            Get
                Return MyBase.Getdecimal(ColumnNames.Precio)
            End Get
            Set(ByVal Value As Decimal)
                MyBase.Setdecimal(ColumnNames.Precio, Value)
            End Set
        End Property

        Public Overridable Property IdImpuesto() As Integer
            Get
                Return MyBase.Getint(ColumnNames.IdImpuesto)
            End Get
            Set(ByVal Value As Integer)
                MyBase.Setint(ColumnNames.IdImpuesto, Value)
            End Set
        End Property

        Public Overridable Property PrecioFinal() As Decimal
            Get
                Return MyBase.Getdecimal(ColumnNames.PrecioFinal)
            End Get
            Set(ByVal Value As Decimal)
                MyBase.Setdecimal(ColumnNames.PrecioFinal, Value)
            End Set
        End Property

        Public Overridable Property IdMercaderiaLote() As Integer
            Get
                Return MyBase.Getint(ColumnNames.IdMercaderiaLote)
            End Get
            Set(ByVal Value As Integer)
                MyBase.Setint(ColumnNames.IdMercaderiaLote, Value)
            End Set
        End Property

        Public Overridable Property MontoImpuesto() As Decimal
            Get
                Return MyBase.Getdecimal(ColumnNames.MontoImpuesto)
            End Get
            Set(ByVal Value As Decimal)
                MyBase.Setdecimal(ColumnNames.MontoImpuesto, Value)
            End Set
        End Property

        Public Overridable Property DescripcionIngreso() As String
            Get
                Return MyBase.Getstring(ColumnNames.DescripcionIngreso)
            End Get
            Set(ByVal Value As String)
                MyBase.Setstring(ColumnNames.DescripcionIngreso, Value)
            End Set
        End Property


#End Region
	
	#Region "String Properties" 

		Public Overridable Property s_IdVentaDetalle As String
			Get
				If Me.IsColumnNull(ColumnNames.IdVentaDetalle) Then
					Return String.Empty
				Else
					Return MyBase.GetintAsString(ColumnNames.IdVentaDetalle)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.IdVentaDetalle)
				Else
					Me.IdVentaDetalle = MyBase.SetintAsString(ColumnNames.IdVentaDetalle, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_IdVenta As String
			Get
				If Me.IsColumnNull(ColumnNames.IdVenta) Then
					Return String.Empty
				Else
					Return MyBase.GetintAsString(ColumnNames.IdVenta)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.IdVenta)
				Else
					Me.IdVenta = MyBase.SetintAsString(ColumnNames.IdVenta, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_IdMercaderia As String
			Get
				If Me.IsColumnNull(ColumnNames.IdMercaderia) Then
					Return String.Empty
				Else
					Return MyBase.GetintAsString(ColumnNames.IdMercaderia)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.IdMercaderia)
				Else
					Me.IdMercaderia = MyBase.SetintAsString(ColumnNames.IdMercaderia, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_Cantidad As String
			Get
				If Me.IsColumnNull(ColumnNames.Cantidad) Then
					Return String.Empty
				Else
					Return MyBase.GetintAsString(ColumnNames.Cantidad)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.Cantidad)
				Else
					Me.Cantidad = MyBase.SetintAsString(ColumnNames.Cantidad, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_Precio As String
			Get
				If Me.IsColumnNull(ColumnNames.Precio) Then
					Return String.Empty
				Else
					Return MyBase.GetdecimalAsString(ColumnNames.Precio)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.Precio)
				Else
					Me.Precio = MyBase.SetdecimalAsString(ColumnNames.Precio, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_IdImpuesto As String
			Get
				If Me.IsColumnNull(ColumnNames.IdImpuesto) Then
					Return String.Empty
				Else
					Return MyBase.GetintAsString(ColumnNames.IdImpuesto)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.IdImpuesto)
				Else
					Me.IdImpuesto = MyBase.SetintAsString(ColumnNames.IdImpuesto, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_PrecioFinal As String
			Get
				If Me.IsColumnNull(ColumnNames.PrecioFinal) Then
					Return String.Empty
				Else
					Return MyBase.GetdecimalAsString(ColumnNames.PrecioFinal)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.PrecioFinal)
				Else
					Me.PrecioFinal = MyBase.SetdecimalAsString(ColumnNames.PrecioFinal, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_IdMercaderiaLote As String
			Get
				If Me.IsColumnNull(ColumnNames.IdMercaderiaLote) Then
					Return String.Empty
				Else
					Return MyBase.GetintAsString(ColumnNames.IdMercaderiaLote)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.IdMercaderiaLote)
				Else
					Me.IdMercaderiaLote = MyBase.SetintAsString(ColumnNames.IdMercaderiaLote, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_MontoImpuesto As String
			Get
				If Me.IsColumnNull(ColumnNames.MontoImpuesto) Then
					Return String.Empty
				Else
					Return MyBase.GetdecimalAsString(ColumnNames.MontoImpuesto)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.MontoImpuesto)
				Else
					Me.MontoImpuesto = MyBase.SetdecimalAsString(ColumnNames.MontoImpuesto, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_DescripcionIngreso As String
			Get
				If Me.IsColumnNull(ColumnNames.DescripcionIngreso) Then
					Return String.Empty
				Else
					Return MyBase.GetstringAsString(ColumnNames.DescripcionIngreso)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.DescripcionIngreso)
				Else
					Me.DescripcionIngreso = MyBase.SetstringAsString(ColumnNames.DescripcionIngreso, Value)
				End If
			End Set
		End Property


	#End Region  	

	#Region "Where Clause"
    Public Class WhereClause

        Public Sub New(ByVal entity As BusinessEntity)
            Me._entity = entity
        End Sub
		
		Public ReadOnly Property TearOff As TearOffWhereParameter
			Get
				If _tearOff Is Nothing Then
					_tearOff = new TearOffWhereParameter(Me)
				End If

				Return _tearOff
			End Get
		End Property

		#Region "TearOff's"
		Public class TearOffWhereParameter

			Public Sub New(ByVal clause As WhereClause)
				Me._clause = clause
			End Sub
		
	
			Public ReadOnly Property IdVentaDetalle() As WhereParameter
				Get
					Dim where As WhereParameter = New WhereParameter(ColumnNames.IdVentaDetalle, Parameters.IdVentaDetalle)
                        Me._clause._entity.Query.AddWhereParameter(where)
                        Return where
                    End Get
                End Property

                Public ReadOnly Property IdVenta() As WhereParameter
                    Get
                        Dim where As WhereParameter = New WhereParameter(ColumnNames.IdVenta, Parameters.IdVenta)
                        Me._clause._entity.Query.AddWhereParameter(where)
                        Return where
                    End Get
                End Property

                Public ReadOnly Property IdMercaderia() As WhereParameter
                    Get
                        Dim where As WhereParameter = New WhereParameter(ColumnNames.IdMercaderia, Parameters.IdMercaderia)
                        Me._clause._entity.Query.AddWhereParameter(where)
                        Return where
                    End Get
                End Property

                Public ReadOnly Property Cantidad() As WhereParameter
                    Get
                        Dim where As WhereParameter = New WhereParameter(ColumnNames.Cantidad, Parameters.Cantidad)
                        Me._clause._entity.Query.AddWhereParameter(where)
                        Return where
                    End Get
                End Property

                Public ReadOnly Property Precio() As WhereParameter
                    Get
                        Dim where As WhereParameter = New WhereParameter(ColumnNames.Precio, Parameters.Precio)
                        Me._clause._entity.Query.AddWhereParameter(where)
                        Return where
                    End Get
                End Property

                Public ReadOnly Property IdImpuesto() As WhereParameter
                    Get
                        Dim where As WhereParameter = New WhereParameter(ColumnNames.IdImpuesto, Parameters.IdImpuesto)
                        Me._clause._entity.Query.AddWhereParameter(where)
                        Return where
                    End Get
                End Property

                Public ReadOnly Property PrecioFinal() As WhereParameter
                    Get
                        Dim where As WhereParameter = New WhereParameter(ColumnNames.PrecioFinal, Parameters.PrecioFinal)
                        Me._clause._entity.Query.AddWhereParameter(where)
                        Return where
                    End Get
                End Property

                Public ReadOnly Property IdMercaderiaLote() As WhereParameter
                    Get
                        Dim where As WhereParameter = New WhereParameter(ColumnNames.IdMercaderiaLote, Parameters.IdMercaderiaLote)
                        Me._clause._entity.Query.AddWhereParameter(where)
                        Return where
                    End Get
                End Property

                Public ReadOnly Property MontoImpuesto() As WhereParameter
                    Get
                        Dim where As WhereParameter = New WhereParameter(ColumnNames.MontoImpuesto, Parameters.MontoImpuesto)
                        Me._clause._entity.Query.AddWhereParameter(where)
                        Return where
                    End Get
                End Property

                Public ReadOnly Property DescripcionIngreso() As WhereParameter
                    Get
                        Dim where As WhereParameter = New WhereParameter(ColumnNames.DescripcionIngreso, Parameters.DescripcionIngreso)
                        Me._clause._entity.Query.AddWhereParameter(where)
                        Return where
                    End Get
                End Property


			Private _clause as WhereClause
		End Class
		#End Region	

		Public ReadOnly Property IdVentaDetalle() As WhereParameter 
			Get
				If _IdVentaDetalle_W Is Nothing Then
					_IdVentaDetalle_W = TearOff.IdVentaDetalle
				End If
				Return _IdVentaDetalle_W
			End Get
		End Property

		Public ReadOnly Property IdVenta() As WhereParameter 
			Get
				If _IdVenta_W Is Nothing Then
					_IdVenta_W = TearOff.IdVenta
				End If
				Return _IdVenta_W
			End Get
		End Property

		Public ReadOnly Property IdMercaderia() As WhereParameter 
			Get
				If _IdMercaderia_W Is Nothing Then
					_IdMercaderia_W = TearOff.IdMercaderia
				End If
				Return _IdMercaderia_W
			End Get
		End Property

		Public ReadOnly Property Cantidad() As WhereParameter 
			Get
				If _Cantidad_W Is Nothing Then
					_Cantidad_W = TearOff.Cantidad
				End If
				Return _Cantidad_W
			End Get
		End Property

		Public ReadOnly Property Precio() As WhereParameter 
			Get
				If _Precio_W Is Nothing Then
					_Precio_W = TearOff.Precio
				End If
				Return _Precio_W
			End Get
		End Property

		Public ReadOnly Property IdImpuesto() As WhereParameter 
			Get
				If _IdImpuesto_W Is Nothing Then
					_IdImpuesto_W = TearOff.IdImpuesto
				End If
				Return _IdImpuesto_W
			End Get
		End Property

		Public ReadOnly Property PrecioFinal() As WhereParameter 
			Get
				If _PrecioFinal_W Is Nothing Then
					_PrecioFinal_W = TearOff.PrecioFinal
				End If
				Return _PrecioFinal_W
			End Get
		End Property

		Public ReadOnly Property IdMercaderiaLote() As WhereParameter 
			Get
				If _IdMercaderiaLote_W Is Nothing Then
					_IdMercaderiaLote_W = TearOff.IdMercaderiaLote
				End If
				Return _IdMercaderiaLote_W
			End Get
		End Property

		Public ReadOnly Property MontoImpuesto() As WhereParameter 
			Get
				If _MontoImpuesto_W Is Nothing Then
					_MontoImpuesto_W = TearOff.MontoImpuesto
				End If
				Return _MontoImpuesto_W
			End Get
		End Property

		Public ReadOnly Property DescripcionIngreso() As WhereParameter 
			Get
				If _DescripcionIngreso_W Is Nothing Then
					_DescripcionIngreso_W = TearOff.DescripcionIngreso
				End If
				Return _DescripcionIngreso_W
			End Get
		End Property

		Private _IdVentaDetalle_W As WhereParameter = Nothing
		Private _IdVenta_W As WhereParameter = Nothing
		Private _IdMercaderia_W As WhereParameter = Nothing
		Private _Cantidad_W As WhereParameter = Nothing
		Private _Precio_W As WhereParameter = Nothing
		Private _IdImpuesto_W As WhereParameter = Nothing
		Private _PrecioFinal_W As WhereParameter = Nothing
		Private _IdMercaderiaLote_W As WhereParameter = Nothing
		Private _MontoImpuesto_W As WhereParameter = Nothing
		Private _DescripcionIngreso_W As WhereParameter = Nothing

			Public Sub WhereClauseReset()

			_IdVentaDetalle_W = Nothing
			_IdVenta_W = Nothing
			_IdMercaderia_W = Nothing
			_Cantidad_W = Nothing
			_Precio_W = Nothing
			_IdImpuesto_W = Nothing
			_PrecioFinal_W = Nothing
			_IdMercaderiaLote_W = Nothing
			_MontoImpuesto_W = Nothing
			_DescripcionIngreso_W = Nothing
				Me._entity.Query.FlushWhereParameters()

			End Sub
	
		Private _entity As BusinessEntity
		Private _tearOff As TearOffWhereParameter
    End Class	

	Public ReadOnly Property Where() As WhereClause
		Get
			If _whereClause Is Nothing Then
				_whereClause = New WhereClause(Me)
			End If
	
			Return _whereClause
		End Get
	End Property
	
	Private _whereClause As WhereClause = Nothing	
#End Region	

#Region "Aggregate Clause"
    Public Class AggregateClause

        Public Sub New(ByVal entity As BusinessEntity)
            Me._entity = entity
        End Sub
		
		Public ReadOnly Property TearOff As TearOffAggregateParameter
			Get
				If _tearOff Is Nothing Then
					_tearOff = new TearOffAggregateParameter(Me)
				End If

				Return _tearOff
			End Get
		End Property

		#Region "AggregateParameter TearOff's"
		Public class TearOffAggregateParameter

			Public Sub New(ByVal clause As AggregateClause)
				Me._clause = clause
			End Sub
		
	
		Public ReadOnly Property IdVentaDetalle() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.IdVentaDetalle, Parameters.IdVentaDetalle)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property IdVenta() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.IdVenta, Parameters.IdVenta)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property IdMercaderia() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.IdMercaderia, Parameters.IdMercaderia)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property Cantidad() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.Cantidad, Parameters.Cantidad)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property Precio() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.Precio, Parameters.Precio)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property IdImpuesto() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.IdImpuesto, Parameters.IdImpuesto)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property PrecioFinal() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.PrecioFinal, Parameters.PrecioFinal)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property IdMercaderiaLote() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.IdMercaderiaLote, Parameters.IdMercaderiaLote)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property MontoImpuesto() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.MontoImpuesto, Parameters.MontoImpuesto)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property DescripcionIngreso() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.DescripcionIngreso, Parameters.DescripcionIngreso)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property


			Private _clause as AggregateClause
		End Class
		#End Region	

		Public ReadOnly Property IdVentaDetalle() As AggregateParameter 
			Get
				If _IdVentaDetalle_W Is Nothing Then
					_IdVentaDetalle_W = TearOff.IdVentaDetalle
				End If
				Return _IdVentaDetalle_W
			End Get
		End Property

		Public ReadOnly Property IdVenta() As AggregateParameter 
			Get
				If _IdVenta_W Is Nothing Then
					_IdVenta_W = TearOff.IdVenta
				End If
				Return _IdVenta_W
			End Get
		End Property

		Public ReadOnly Property IdMercaderia() As AggregateParameter 
			Get
				If _IdMercaderia_W Is Nothing Then
					_IdMercaderia_W = TearOff.IdMercaderia
				End If
				Return _IdMercaderia_W
			End Get
		End Property

		Public ReadOnly Property Cantidad() As AggregateParameter 
			Get
				If _Cantidad_W Is Nothing Then
					_Cantidad_W = TearOff.Cantidad
				End If
				Return _Cantidad_W
			End Get
		End Property

		Public ReadOnly Property Precio() As AggregateParameter 
			Get
				If _Precio_W Is Nothing Then
					_Precio_W = TearOff.Precio
				End If
				Return _Precio_W
			End Get
		End Property

		Public ReadOnly Property IdImpuesto() As AggregateParameter 
			Get
				If _IdImpuesto_W Is Nothing Then
					_IdImpuesto_W = TearOff.IdImpuesto
				End If
				Return _IdImpuesto_W
			End Get
		End Property

		Public ReadOnly Property PrecioFinal() As AggregateParameter 
			Get
				If _PrecioFinal_W Is Nothing Then
					_PrecioFinal_W = TearOff.PrecioFinal
				End If
				Return _PrecioFinal_W
			End Get
		End Property

		Public ReadOnly Property IdMercaderiaLote() As AggregateParameter 
			Get
				If _IdMercaderiaLote_W Is Nothing Then
					_IdMercaderiaLote_W = TearOff.IdMercaderiaLote
				End If
				Return _IdMercaderiaLote_W
			End Get
		End Property

		Public ReadOnly Property MontoImpuesto() As AggregateParameter 
			Get
				If _MontoImpuesto_W Is Nothing Then
					_MontoImpuesto_W = TearOff.MontoImpuesto
				End If
				Return _MontoImpuesto_W
			End Get
		End Property

		Public ReadOnly Property DescripcionIngreso() As AggregateParameter 
			Get
				If _DescripcionIngreso_W Is Nothing Then
					_DescripcionIngreso_W = TearOff.DescripcionIngreso
				End If
				Return _DescripcionIngreso_W
			End Get
		End Property

		Private _IdVentaDetalle_W As AggregateParameter = Nothing
		Private _IdVenta_W As AggregateParameter = Nothing
		Private _IdMercaderia_W As AggregateParameter = Nothing
		Private _Cantidad_W As AggregateParameter = Nothing
		Private _Precio_W As AggregateParameter = Nothing
		Private _IdImpuesto_W As AggregateParameter = Nothing
		Private _PrecioFinal_W As AggregateParameter = Nothing
		Private _IdMercaderiaLote_W As AggregateParameter = Nothing
		Private _MontoImpuesto_W As AggregateParameter = Nothing
		Private _DescripcionIngreso_W As AggregateParameter = Nothing

		Public Sub AggregateClauseReset()

		_IdVentaDetalle_W = Nothing
		_IdVenta_W = Nothing
		_IdMercaderia_W = Nothing
		_Cantidad_W = Nothing
		_Precio_W = Nothing
		_IdImpuesto_W = Nothing
		_PrecioFinal_W = Nothing
		_IdMercaderiaLote_W = Nothing
		_MontoImpuesto_W = Nothing
		_DescripcionIngreso_W = Nothing
			Me._entity.Query.FlushAggregateParameters()

		End Sub
	
		Private _entity As BusinessEntity
		Private _tearOff As TearOffAggregateParameter
    End Class	

	Public ReadOnly Property Aggregate() As AggregateClause
		Get
			If _aggregateClause Is Nothing Then
				_aggregateClause = New AggregateClause(Me)
			End If
	
			Return _aggregateClause
		End Get
	End Property
	
	Private _aggregateClause As AggregateClause = Nothing	
#End Region	

	Protected Overrides Function GetInsertCommand() As IDbCommand
	
		Dim cmd As SqlCommand = New SqlCommand
		cmd.CommandType = CommandType.StoredProcedure
		cmd.CommandText = "[" + Me.SchemaStoredProcedure + "proc_si_venta_detalleInsert]" 
	    
		CreateParameters(cmd)
		
		Dim p As SqlParameter
		p = cmd.Parameters(Parameters.IdVentaDetalle.ParameterName)
		p.Direction = ParameterDirection.Output
    
		Return cmd 

  	End Function
	
	Protected Overrides Function GetUpdateCommand() As IDbCommand
	
		Dim cmd As SqlCommand = New SqlCommand
		cmd.CommandType = CommandType.StoredProcedure    
		cmd.CommandText = "[" + Me.SchemaStoredProcedure + "proc_si_venta_detalleUpdate]" 
		
		CreateParameters(cmd) 
		    
		Return cmd
	
	End Function	
	
	Protected Overrides Function GetDeleteCommand() As IDbCommand
	
		Dim cmd As SqlCommand = New SqlCommand
		cmd.CommandType = CommandType.StoredProcedure    
		cmd.CommandText = "[" + Me.SchemaStoredProcedure + "proc_si_venta_detalleDelete]" 
		
		Dim p As SqlParameter
		p = cmd.Parameters.Add(Parameters.IdVentaDetalle)
		p.SourceColumn = ColumnNames.IdVentaDetalle
		p.SourceVersion = DataRowVersion.Current

  
		Return cmd
	
	End Function	
	
	Private Sub CreateParameters(ByVal cmd As SqlCommand)
	
		Dim p As SqlParameter
		p = cmd.Parameters.Add(Parameters.IdVentaDetalle)
		p.SourceColumn = ColumnNames.IdVentaDetalle
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.IdVenta)
		p.SourceColumn = ColumnNames.IdVenta
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.IdMercaderia)
		p.SourceColumn = ColumnNames.IdMercaderia
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.Cantidad)
		p.SourceColumn = ColumnNames.Cantidad
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.Precio)
		p.SourceColumn = ColumnNames.Precio
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.IdImpuesto)
		p.SourceColumn = ColumnNames.IdImpuesto
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.PrecioFinal)
		p.SourceColumn = ColumnNames.PrecioFinal
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.IdMercaderiaLote)
		p.SourceColumn = ColumnNames.IdMercaderiaLote
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.MontoImpuesto)
		p.SourceColumn = ColumnNames.MontoImpuesto
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.DescripcionIngreso)
		p.SourceColumn = ColumnNames.DescripcionIngreso
		p.SourceVersion = DataRowVersion.Current


	End Sub	

End Class

End NameSpace

